#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
const int N = 410;
int n, m, x, y;
int a[N][N];
bool vis[N][N];
int dx[] = { -1,-2,-2,-1,1,2,2,1 };
int dy[] = { -2,-1,1,2,2,1,-1,-2 };

struct node {
	int x, y;
}p;

int main() {
	scanf("%d%d%d%d", &n, &m, &x, &y);
	memset(a, -1, sizeof a);
	queue<node> q;
	p = { x,y };
	q.push(p);
	a[x][y] = 0;
	vis[x][y] = true;
	while (!q.empty()) {
		p = q.front();
		q.pop();
		for (int i = 0; i < 8; i++) {
			int xx = p.x + dx[i], yy = p.y + dy[i];
			if (xx<1 || xx>n || yy<1 || yy>m || vis[xx][yy]) continue;
			a[xx][yy] = a[p.x][p.y] + 1;
			vis[xx][yy] = true;
			q.push({ xx,yy });
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			printf("%-5d", a[i][j]);
		}
		printf("\n");
	}
	return 0;
}